//连接数据库
const db = require('../utils/db')

class UserModel {

  constructor(){
    this.model=db.model('users',{
      username:String,
      password:String
    })
  }

  save(data){
    let userModel = new this.model(data)
    return userModel.save();
  }

  findOne(data){
    return this.model.findOne(data)

  }

}

module.exports = new UserModel();
